<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="login-form">
            <h1>请输入新的用户名密码</h1>
            <form action="changepass" method="POST">
                <input type="text" name="username" class="username" placeholder="用户名" required>
                <input type="password" name="password" class="password" placeholder="密码" required>
                <input type="submit" id="changeBtn" value="提交修改">
            </form>
        </div>
    </div>
  </div>
  
  <script type="text/javascript">
        $.ajaxSetup({ cache: false });

$("#changeBtn").click(function () {
    $user = $(".username").val();
    $password = $(".password").val();
    if (!$user || !$password) return;

    $.post('./changepass', { username: $user, password: $password }, function (data) {
        let icon = (data.err == 0) ? "success" : "error"
        Swal.fire({
            text: data.msg,
            icon: icon
        })
    });
    return false;
});
    layui.use(["layer"], function () {
      var $ = layui.jquery,
        layer = layui.layer;
    });
  </script>
  